package com.action;

import java.util.ArrayList;
import java.util.List;

import org.apache.struts2.ServletActionContext;

import com.dao.ZhengHouDao;
import com.dao.ZhengZhuangDao;
import com.dao.impl.ZhengHouDaoImpl;
import com.dao.impl.ZhengZhuangDaoImpl;
import com.entity.ZhengHou;
import com.entity.ZhengZhuang;
import com.opensymphony.xwork2.ActionSupport;

public class SearchAction extends ActionSupport {
	private String searchZZType;
	private String searchZZValue;
	public String getSearchZZType() {
		return searchZZType;
	}

	public void setSearchZZType(String searchZZType) {
		this.searchZZType = searchZZType;
	}

	public String getSearchZZValue() {
		return searchZZValue;
	}

	public void setSearchZZValue(String searchZZValue) {
		this.searchZZValue = searchZZValue;
	}



	public String searchZZ(){
		ZhengZhuangDao zzd=new ZhengZhuangDaoImpl();
		List<ZhengZhuang> zzlist=new ArrayList<ZhengZhuang>();
		zzlist=zzd.searchZz(searchZZType, searchZZValue);
		if(zzlist==null){
			return "fail";
		}
		ServletActionContext.getRequest().setAttribute("zzlist",zzlist);
		return "success";
	}
	public String searchZH(){
		ZhengHouDao zhd=new ZhengHouDaoImpl();
		ZhengHou zh=new ZhengHou();
		List<ZhengHou> zhlist=new ArrayList();
		zhlist=zhd.searchZH(searchZZType, searchZZValue);
		if(zhlist==null){
			return "fail";
		}
		ServletActionContext.getRequest().setAttribute("zhlist",zhlist);
		return "success";
	}
	public String searchME(){
		return "success";
	}
	
}
